package com.haixiaoke.saas.repository.service.impl;

import com.haixiaoke.saas.repository.mapper.ApartmentChargeItemUsageMapper;
import com.haixiaoke.saas.repository.pojo.ApartmentChargeItemUsage;
import com.haixiaoke.saas.repository.service.IApartmentChargeItemUsageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * 公寓收费项目用量Service业务层处理
 *
 * @author qixi
 * @date 2023-06-16
 */
@Service
public class ApartmentChargeItemUsageServiceImpl implements IApartmentChargeItemUsageService {
    @Autowired
    private ApartmentChargeItemUsageMapper apartmentChargeItemUsageMapper;

    /**
     * 查询公寓收费项目用量
     *
     * @param usageId 公寓收费项目用量主键
     * @return 公寓收费项目用量
     */
    @Override
    public ApartmentChargeItemUsage selectApartmentChargeItemUsageByUsageId(Long usageId) {
        return apartmentChargeItemUsageMapper.selectApartmentChargeItemUsageByUsageId(usageId);
    }

    /**
     * 查询公寓收费项目用量列表
     *
     * @param apartmentChargeItemUsage 公寓收费项目用量
     * @return 公寓收费项目用量
     */
    @Override
    public List<ApartmentChargeItemUsage> selectApartmentChargeItemUsageList(ApartmentChargeItemUsage apartmentChargeItemUsage) {
        return apartmentChargeItemUsageMapper.selectApartmentChargeItemUsageList(apartmentChargeItemUsage);
    }

    /**
     * 新增公寓收费项目用量
     *
     * @param apartmentChargeItemUsage 公寓收费项目用量
     * @return 结果
     */
    @Override
    public int insertApartmentChargeItemUsage(ApartmentChargeItemUsage apartmentChargeItemUsage) {
        apartmentChargeItemUsage.setCreateTime(new Date());
        return apartmentChargeItemUsageMapper.insertApartmentChargeItemUsage(apartmentChargeItemUsage);
    }

    /**
     * 修改公寓收费项目用量
     *
     * @param apartmentChargeItemUsage 公寓收费项目用量
     * @return 结果
     */
    @Override
    public int updateApartmentChargeItemUsage(ApartmentChargeItemUsage apartmentChargeItemUsage) {
        apartmentChargeItemUsage.setUpdateTime(new Date());
        return apartmentChargeItemUsageMapper.updateApartmentChargeItemUsage(apartmentChargeItemUsage);
    }

    /**
     * 批量删除公寓收费项目用量
     *
     * @param usageIds 需要删除的公寓收费项目用量主键
     * @return 结果
     */
    @Override
    public int deleteApartmentChargeItemUsageByUsageIds(Long[] usageIds) {
        return apartmentChargeItemUsageMapper.deleteApartmentChargeItemUsageByUsageIds(usageIds);
    }

    /**
     * 删除公寓收费项目用量信息
     *
     * @param usageId 公寓收费项目用量主键
     * @return 结果
     */
    @Override
    public int deleteApartmentChargeItemUsageByUsageId(Long usageId) {
        return apartmentChargeItemUsageMapper.deleteApartmentChargeItemUsageByUsageId(usageId);
    }

    @Override
    public List<ApartmentChargeItemUsage> selectApartmentChargeItemUsageByBillId(String billId) {
        return apartmentChargeItemUsageMapper.selectApartmentChargeItemUsageByBillId(billId);
    }

    @Override
    public int insertApartmentChargeItemUsageBatch(List<ApartmentChargeItemUsage> usages) {
        return apartmentChargeItemUsageMapper.insertApartmentChargeItemUsageBatch(usages);
    }
}
